<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<!DOCTYPE html>
<html lang="zh-CN"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<style type="text/css">
	
	.body{
     background-img:url(img/333.png);
    background-color:#F5F5F5;
 /*     margin-top:45px; */
  }
	</style>
	
	
</head>
<body class="body">
	

	<div class="navbar navbar-fixed-top"  >
		<div class="navbar-inner" >
		
			<div class="container">
			<marquee scrolldelay="40" direction="right" onmouseover="this.stop()" onMouseOut="this.start()">
				<a class="brand" href="main.jspx" style="color:red;margin-top:0px;">凯盛项目管理系统  欢迎你的登陆！</a>
				</marquee>
			</div>
		</div>
	</div>
	
	
	<div class="container" id="s" >
	  <div class="row"  >
		<div class="span3" >
			<div style="padding: 8px 0;" class="well">
				<ul class="nav nav-list">
				  <li class="nav-header">新Apple总部项目</li>
				  <li class="divider"></li>
				  <li class="active"><a href="pro.jspx?_m=lm&id=${sessionScope.mypro.id}"><i class="icon-white icon-home"></i>最新动态</a></li>
				  <li><a href="goal.jspx?_m=s1"><i class="icon-flag"></i>目标</a></li>
				  <li><a href="document.jspx?_m=d1"><i class="icon-folder-open"></i>资料库</a></li>
				  <li><a href="file.jspx"><i class="icon-file"></i>文件共享</a></li>
				  <li><a href="contact.jspx?_m=c5"><i class="icon-user"></i>联系人</a></li>
				  <li><a href="idea.jspx"><i class="icon-fire"></i>想法</a></li>
				  <li><a href="#"><i class="icon-warning-sign"></i>Bug</a></li>
				  <li><a href="#"><i class="icon-cog"></i>项目设置</a></li>
				</ul>
			</div>
		</div>
		<div class="span9">
			
			<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0">
				<li class="active">
					<a href="task.html"><i class="icon-user"></i>联系人</a>
				</li>
			</ul>
			<div class="wall">
				<div class="row">
					<div class="span3">
						<a href="contact.jspx?_m=c2" class="btn span2"><i class="icon-plus"></i>添加联系人</a>
						<div class="clear"></div>
						<ul class="unstyled" style="margin-top:15px">
						    <c:forEach items="${requestScope.listcontact}" var="clist">
							<li style="line-height:30px">
								<i class="icon-list-alt"></i><a href="javascript:;" rel="${clist.id}" id="a">${clist.name}</a>
							</li>
							</c:forEach>
							<!-- <li style="line-height:30px">
								<i class="icon-list-alt"></i><a href="">乔布斯</a>
							</li>
							<li style="line-height:30px">
								<i class="icon-list-alt"></i><a href="">阿诺施瓦辛格</a>
							</li> -->
						</ul>
					</div>
					<div class="span5" style="min-height:400px;border-left:1px solid #ccc;padding-left:15px" id="result">
							<div id="loading" style="padding-left:100px;padding-top:100px;display:none">
							<img alt="" src="img/contact-loading.gif">							
						</div>
				                    
						<%-- <address>
							<h3>${requestScope.ct.name}</h3>
							<p>${requestScope.ct.companyname}</p>
							<small>手机</small> ${requestScope.ct.moblie}<br>
							<small>固话</small> ${requestScope.ct.tel}<br><br>
							<small>邮箱</small> ${requestScope.ct.email}<br>
							<small>地址</small> ${requestScope.ct.address}<br><br>
							<small>主页</small> <a href="${requestScope.ct.website}">${requestScope.ct.website}</a><br>
							<small>微博</small> <a href="${requestScope.ct.weibo}">@${requestScope.ct.weiboname}</a><br>
						</address>
						<div class="line">记录</div>
						<c:forEach items="${requestScope.listnote}" var="nlist">
						<blockquote>
						  ${nlist.content}
						  <small>${nlist.time}</small>
						</blockquote>
						</c:forEach>
						<!-- <blockquote>
						  中午一起吃的午饭
						  <small>樊凯发布于 4天前</small>
						</blockquote>
						<blockquote>
						  初次见面，不错不错...
						  <small>樊凯发布于 1个月前</small>
						</blockquote> -->
						<a href="http://192.168.0.77/pms/contact_note.html">查看所有记录</a>
						<br><br><br>
						<a class="btn btn-primary" href="http://192.168.0.77/pms/edit_contact.html"><i class="icon-pencil icon-white"></i>编辑</a>
						<a class="btn btn-danger"><i class="icon-trash icon-white"></i>删除</a>
					</div> --%>
				</div>
			</div>
			
			
			
		</div>
	  </div>
	</div>
<script>
 $(document).ready(function(){
 
 
    $("a").click(function(){
         var cid=$(this).attr("rel");
        
        
    $.post("contact.jspx",{"cid":cid,_m:'c6'},function(date){
                $("#result").text("");
                
            $(date).each(function (){
                
                 
               var   names= ("<div><h4>"+this.name+"</small></div>");
               var    company=("<div><h4>"+this.companyname+"</small></div>");
               var    moblie=$("<div><h4>").text("手机").append(this.moblie);
               var    tel=$("<div><h4>").text("固话").append(this.tel);
               var    email=$("<div><h4>").text("邮箱").append(this.email);
               var    address=$("<div><h4>").text("地址").append(this.address);
               var    website=$("<div><h4>").text("主页").append($("<a>").attr("href",this.website).text(this.website));
               var    weibo=$("<div><h4>").text("微博").append($("<a>").attr("href","http://"+this.weibo).text("@"+this.weiboname));
                var    content=$("<div><h4>").text("简介").append($("<div>"+this.content+"</div>"));
/*                 var    contents=$("<div>"+this.content+"</div>"); */
                var img=$("<img>").attr("src","img/yz.png").attr("style","float:right");

                $("#result").append(names);
                $("#result").append(company);
                $("#result").append(moblie);
                $("#result").append(tel);
                $("#result").append(email);     
                $("#result").append(address);     
                $("#result").append(website);     
                $("#result").append(weibo);  
                $("#result").append(content);
                    $("#result").append(img);
                 $("#result").append("记录");  
                 
                 var list=this.result;
                     for(var i=0;i<list.length;i++){
                          var v=list[i].content;
                          var username=list[i].employee.username;
                          var user=$("<p>").text(username+" "+" "+list[i].createtime);
                          var time=$("<div>").text(list[i].time);
                          var notes=$("<div>").text(" "+v);
                       
                            $("#result").append(user); 
                           $("#result").append(notes);  
                           $("#result").append(time);  
                           
                     }  
                  var cha=$("<div>").append($("<a>").attr("href","contact.jspx?_m=c8&cid="+this.id).attr("style","float:right;color:#333").text("查看所有记录")); 
                    var bianji=$("<a>").attr("href","contact.jspx?_m=c7&cid="+this.id).text("编辑");  
                      var del=$("<a>").attr("href","contact.jspx?_m=del&cid="+this.id).text("  "+"删除");  
                  
                      $("#result").append(cha); 
                      $("#result").append(bianji);
                      $("#result").append(del);
                  
    })
    
    
    
  
    } )
 
  
 
 })
 
  //设置loading效果
 $("#loading").ajaxStart(function(){
    			$("#msg").text("");
    			$(this).show();
    		});
    		
    		$("#loading").ajaxComplete(function(){
    			$(this).hide();
    		});
 
 })
 
					

/* 
	var xmlHttp;
		
		function createXMLHttp() {
			if(window.ActiveXObject) {
	    		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	    	} else {
	    		xmlHttp = new XMLHttpRequest();
	    	}
		}
$(document).ready(function(){
	$("a").click(function() {
		 var cid=$(this).attr("rel");
		
		
		alert(cid); 
		createXMLHttp();
		xmlHttp.open("post","contact.jspx?_m=c6&cid=" + cid, true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	  			xmlHttp.onreadystatechange = callback;
	  			xmlHttp.send();
		})});
          function  callback(){
            if(xmlHttp.readyState == 4) {
				if(xmlHttp.status == 200) {
					//接受服务端返回的xml数据
					//var xml = xmlHttp.responseText;
					 var json = JSON.parse(xmlHttp.responseText);
					 var name=json.name;
				     var companyname=json.companyname;
				    
				     
				     
				     
				  document.getElementById("result").innerHTML = "";
				     var resultDiv = document.createElement("div");
                      var h4 = document.createElement("h4");
                      
						var h4Value = document.createTextNode(name);
						h4.appendChild(h4Value);
						resultDiv.appendChild(h4);
						
						var lowDiv = document.createElement("div");
						var lowValue = document.createTextNode(companyname);
						lowDiv.appendChild(lowValue);
						resultDiv.appendChild(lowDiv);

						document.getElementById("result").appendChild(resultDiv); */
					/* var contact=xml.getElementsByTagName("contact")[0];
						document.getElementById("result").innerHTML = "";
					var name=contact.getElementsByTagName("name")[0].childNodes[0].nodeValue;
					
					var companyname=contact.getElementsByTagName("company")[0].childNodes[0].nodeValue;
					var resultDiv = document.createElement("div");
					
                      var h4 = document.createElement("h4");
						var h4Value = document.createTextNode(name);
						h4.appendChild(h4Value);
						resultDiv.appendChild(h4);
						
						
						var lowDiv = document.createElement("div");
						var lowValue = document.createTextNode(companyname);
						lowDiv.appendChild(lowValue);
						resultDiv.appendChild(lowDiv);
						
						document.getElementById("result").appendChild(resultDiv);*/
       
       

</script>
</body></html>